var _ = require('lodash');
var Util = require('./util');
var models = require('../models');

var SysLog = models.SysLog;

/**
 * 创建日志
 * @param {*} req 
 * @param {*} content - 日志内容
 */
var Log = function(req, content, user){
    var logID = Util.getUUID();
    //console.log(req.session.user);
    var log = {
        'id': logID,
        'content': content,
        'source': req.baseUrl,
        'userID': user.id,
        'levelID': user.powerLevelId,
        'createTime': Util.getNowTime()
    };
    SysLog.create(log);
}

exports.Log = Log;
